<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

session_start();

class Carona extends CI_Controller {
    
    function __construct() {
        parent::__construct();
    }
    
    function index() {
        if($this->session->userdata('logged_in')){
            $session_data = $this->session->userdata('logged_in');
            $data['nome'] = $session_data['nome'];
            $this->load->view('carona_view',$data);
        }
        else {
            redirect('login','refresh');
        }
    }
    
    function cadastrarC() {
        $this->load->view('carona_cadastro');
    }
    
    function logout() {
        $this->session->unset_userdata('logged_in');
        $this->session->sess_destroy();
        redirect('user','refresh');
    }
    
}

?>
